package cn.tedu.reflection;/**
 * @Author 金帮嘉诚 @Date 2021-06-25 星期五 8:33
 */
/*本类用于测试*/

import org.junit.Test;

import java.lang.reflect.Constructor;
import java.util.Arrays;

/**知识点*/
public class TestReflect1 {
    @Test
    public void getClazz() throws ClassNotFoundException {
        Class<?> student1=Class.forName("cn.tedu.reflection.Student");
        Class<?> student2=Student.class;
        Class<?> student3 = new Student().getClass();

        System.out.println(student1.getName());
        System.out.println(student1.getPackage().getName());
        System.out.println(student1.getSimpleName());
    }
    @Test
    public void getConstruct(){
        Class<?> student1=Student.class;
        Constructor<?>[] cs = student1.getConstructors();
        for (Constructor c:cs
             ) {
            System.out.println(c.getName());//

            Class[] cp = c.getParameterTypes();
            System.out.println(Arrays.toString(cp));
        }
    }
}
